//TestMy_String.cc
#include "My_String.h"
using namespace My_Code;
using namespace std;
int main()
{
    const int num = 5;
    My_Code::My_String name;
    cout<<"Hi,What's your name?\n";
    cin>>name;
    cout<<name<<",please enter up to "<<num<<" short saying<空行则退出>"<<endl;
    My_String sayings[num];
    char temp[80];
    int i;
    for(i = 0;i < 5;i++)
    {
        cout<<i + 1<<":";
        cin.get(temp,80);
        while(cin && cin.get() != '\n')
        continue;
        if(!cin || temp[0] == '\n')
        break;
        else
        sayings[i] = temp;
    }
    int total = i;
    if(total > 0)
    {
        cout<< "here are your sayings:\n";
        for(i = 0;i < total;i++)
        {
            cout<<sayings[i][0]<<"."<<sayings[i]<<endl;
        }
        int shortest = 0;
        int first = 0;
        for(i=1;i < total;i++)
        {
            if(sayings[i].length() < sayings[shortest].length())
            shortest = i;
            if(sayings[i] < sayings[first])
            first = i;
        }
        cout<<"shortest sayings:\n"<<sayings[shortest]<<endl;
        cout<<"First alphabetically:\n"<<sayings[first]<<endl;
    }
    return 0;
}